home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / ccs_util.jar / test / framework / TestResult.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-12-09  |  1.8 KB  |  59 lines

  1. package test.framework;
  2.  
  3. import java.util.Enumeration;
  4. import java.util.Vector;
  5.  
  6. public class TestResult {
  7.    protected Vector fFailures = new Vector(10);
  8.    protected Vector fErrors = new Vector(10);
  9.    protected int fRunTests = 0;
  10.    private boolean fStop = false;
  11.  
  12.    public synchronized void addError(Test test, Throwable t) {
  13.       this.fErrors.addElement(new TestFailure(test, t));
  14.    }
  15.  
  16.    public synchronized void addFailure(Test test, Throwable t) {
  17.       this.fFailures.addElement(new TestFailure(test, t));
  18.    }
  19.  
  20.    public synchronized void startTest(Test test) {
  21.       ++this.fRunTests;
  22.    }
  23.  
  24.    public synchronized void endTest(Test test) {
  25.    }
  26.  
  27.    public synchronized int runTests() {
  28.       return this.fRunTests;
  29.    }
  30.  
  31.    public synchronized int testErrors() {
  32.       return this.fErrors.size();
  33.    }
  34.  
  35.    public synchronized int testFailures() {
  36.       return this.fFailures.size();
  37.    }
  38.  
  39.    public synchronized boolean wasSuccessful() {
  40.       return this.testFailures() == 0 && this.testErrors() == 0;
  41.    }
  42.  
  43.    public synchronized Enumeration failures() {
  44.       return this.fFailures.elements();
  45.    }
  46.  
  47.    public synchronized Enumeration errors() {
  48.       return this.fErrors.elements();
  49.    }
  50.  
  51.    public synchronized void stop() {
  52.       this.fStop = true;
  53.    }
  54.  
  55.    public synchronized boolean shouldStop() {
  56.       return this.fStop;
  57.    }
  58. }
  59.